package cn.kgc.service.impl;

import cn.kgc.bean.pojo.EpStaff;
import cn.kgc.mapper.EpStaffMapper;
import cn.kgc.service.EpStaffService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
/*
 *@author zhangtao
 *@Date 2023/4/27
 */

@Service("epStaffService")
public class EpStaffServiceimpl  implements EpStaffService {

    @Resource
    private EpStaffMapper epStaffMapper;


    /*
     *@author wangchangsheng
     *@Date 2023/4/27
     * 人员管理(分页查询)
     */
    @Override
    public List<EpStaff> getAllInfoEpStaff() {
        return epStaffMapper.getAllInfoEpStaff();
    }

    /*
     *@author wangchangsheng
     *@Date 2023/4/28
     * 人员管理(模糊查询)
     */
    @Override
    public List<EpStaff> getEpStaffByAgeAndGenderAndEducationAndDepartment(Integer age, String gender, String education, String department,String staffId,String name) {
        return epStaffMapper.getEpStaffByAgeAndGenderAndEducationAndDepartment(age,gender,education,department,staffId,name);
    }


    /*
     *@author wangchangsheng
     *@Date 2023/4/27
     * 人员录入(员工录入)
     */
    @Override
    public boolean addEpStaff(EpStaff epStaff) {
        int count = epStaffMapper.addEpStaff(epStaff);
        if (count>0){
            return true;
        }else{
            return false;
        }

    }

    /*
     *@author wangchangsheng
     *@Date 2023/4/28
     * 人员管理(员工删除)
     */
    @Override
    public boolean delEpStaff(Long id) {
        int count = epStaffMapper.delEpStaff(id);
        if (count>0){
            return true;
        }else{
            return false;
        }
    }

    /*
     *@author wangchangsheng
     *@Date 2023/4/28
     * 人员录入(修改信息)
     */
    @Override
    public boolean updateEpStaff(EpStaff epStaff) {
        int count = epStaffMapper.updateEpStaff(epStaff);
        if (count>0){
            return true;
        }else{
            return false;
        }
    }


    /**
     * @description 查询人员违章情况
     * @author panchongxin
     * @param :
     * @return List<EpStaff>
     * @date 2023/5/5 15:53
     */
    @Override
    public List<EpStaff> showStaffInfo(Integer age, String gender, String education, String department) {
        return epStaffMapper.showStaffInfo(age,gender,education,department);
    }

    @Override
    public boolean updateScoreByStaffId(String staffId, Integer score) {
        int count = epStaffMapper.updateScoreByStaffId(staffId,score);
        if(count > 0){
            return true;
        }
        return false;
    }
}
